package com.bbs.toutiao.service.admin.impl;

import com.bbs.toutiao.aspect.SysLog;
import com.bbs.toutiao.entity.LogsEntity;
import com.bbs.toutiao.mapper.admin.LogSysMapper;
import com.bbs.toutiao.service.admin.LogSysService;
import com.bbs.toutiao.vo.comm.PageVo;
import com.bbs.toutiao.vo.logs.LogsVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 描述: 日志service层
 * 作者： zhangBin
 * 时间： 2024/3/4 22:41
 * 版本： 1.0
 */

@Slf4j
@Service
public class LogSysServiceImpl implements LogSysService {

    @Resource
    LogSysMapper logSysMapper;


    @Override
    public int logSave(LogsEntity logsEntity) {

        return  logSysMapper.saveLog(logsEntity);
    }


//    @SysLog("管理员查询了日志列表")
    @Override
    public PageVo<LogsEntity> selectLogs(LogsVo logsVo) {
        List<LogsEntity> list = logSysMapper.selectLogsByPage(logsVo);
        long sum = logSysMapper.countLogsByPage(logsVo);
        PageVo<LogsEntity> page = new PageVo<>();
        page.setPageList(list);
        page.setTotal(sum);
        return page;
    }
}
